package Exc.service.impl;

import Exc.domain.PersonalInformation;
import Exc.mapper.PersonalInformationMapper;
import Exc.service.IPersonalInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author fengke
 */
@Service
public class PersonalInformationServiceImpl implements IPersonalInformationService {

    @Autowired
    private PersonalInformationMapper personalInformationMapper;

    /**
     * 列出所有数据
     * @return
     */
    @Override
    public List<PersonalInformation> listPersonal() {
        return personalInformationMapper.selectInformation();
    }

    /**
     * 向数据库插入新数据
     * @param personalInformation
     */
    @Override
    public void saveInformation(PersonalInformation personalInformation) {
        personalInformationMapper.insertOne(personalInformation);
    }

    /**
     * 更新数据
     * @param personalInformation
     */
    @Override
    public void updateInformation(PersonalInformation personalInformation) {
        personalInformationMapper.update(personalInformation);
    }

    @Override
    public void deleteInformation(String phoneNumber) {
        personalInformationMapper.delete(phoneNumber);
    }
}
